layui.config({
    base: '../../../eui/plugins/layui-extend/' //这是你存放拓展模块的根目录
});
var tree;
layui.use(['eleTree'], function(){
	var eleTree = layui.eleTree;
	io.get('/sw/category/0', function (res) {
        var iList = res.data;
		tree = eleTree({
            el: '#industries',
            data: iList,
            highlightCurrent: true,
            isDefaultChangePstatus: true,
            lazy:true,
            request: {     // 对后台返回的数据格式重新定义
                name: "industryName",
                key: "id",
                children: "children",
                isLeaf: "leaf"
            },
        });
	    tree.on('lazyload',function(d){
			var data = d.data;
		    var load = d.load;
			io.get('/sw/category/'+data.industryCode, function (res) {
	        	var iList = res.data;
				load(iList);
	        });
	    });   
    });
});